package cn.org.gldd.agent.config;

import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.document.Document;
import org.springframework.ai.embedding.EmbeddingModel;
import org.springframework.ai.vectorstore.SimpleVectorStore;
import org.springframework.ai.vectorstore.VectorStore;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.List;

@Configuration
public class RagConfig {

    @Bean
    public ChatClient chatClient(ChatClient.Builder chatClientBuilder) {
        return chatClientBuilder.defaultSystem("你是一名旅游规划专家，请根据用户的需求和问题提供专业的旅游建议和规划。")
                .build();
    }

    @Bean
    public VectorStore simpleVectorStore(EmbeddingModel embeddingModel) {
//        SimpleVectorStore simpleVectorStore =  SimpleVectorStore.builder(embeddingModel).build();

//        List<Document> documents = List.of(
//                new Document("苏州作为南方城市的代表，拥有丰富的历史和文化遗产，你可以在苏州的古典园林中感受到江南水乡的独特魅力,还有十全街的美食")
//        );
//        simpleVectorStore.add(documents);
        return SimpleVectorStore.builder(embeddingModel).build();
    }
}
